home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Code Samples / autofind / media / mkcarads.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  7.1 KB  |  87 lines  |  [TEXT/ttxt]

  1. --<<<-
  2. -- Filename:
  3. --            impads.sx
  4. -- Other Files Required:  
  5. --            mediaimp.sx, adobject.sx (In the parentDir of theScriptDir)
  6. --            database.sx, rawdata.sx (In the scriptDir)
  7. --            media(Folder)
  8. -- Purpose:
  9. --             Imports all the media into a storagecontainer to be used by the 
  10. --                ClassifiedAds document
  11. -- Author:
  12. --            Dionn M. Stewart
  13.  
  14. module carData
  15. uses ScriptX
  16. end
  17.  
  18. in module carData
  19.  
  20. (
  21. -- raw data to import from
  22. local classifiedData := #(
  23. #(129, "4-Door Sedan", "BMW 325i", 1993, 22500, "1993 BMW 325i, red, w/tan leather interior, fully loaded, very clean, all book and records, extended warrenty, only 51k low miles. $21,500. 408-555-1000", 121, 375),
  24. #(130, "4-Door Sedan", "BMW 325i", 1992, 22000, "1992 BMW 325im 1 owner, 30k miles, 4 dr., black leather int./ silver ext., sunroof, ac, ps, CD/cass., exc. cond. moving to Europe, must sell. $20,000 obo. 415-555-0123", 170, 122),
  25. #(131, "4-Door Sedan", "BMW 325i", 1987, 23000, "1989 BMW 325i, 92k miles, fully loaded, sunroof, 5 spd., silver w/ black leather int., asking $17,000. 415-555-3210", 390, 250),
  26. #(132, "Sport-Utility", "Jeep Cherokee", 1989, 14500, "1989 Jeep Cherokee limited edition. Tan leather int., all records, CD/cass., 5 spd. must sell, $14,500. 415-555-1212", 180, 130),
  27. #(133, "Sport-Utility", "Jeep Cherokee", 1993, 15000, "1993 Jeep Cherokee. 20k miles. transfer warrenty. Sunroof,  very clean, manual trans., asking $15,000 obo, 408-555-5632", 149, 375),
  28. #(134, "Sport-Utility", "Jeep Cherokee", 1992, 13000, "1992 Jeep Cherokee, only 50k low miles. New tires, 5 spd. CD/cass. exlnt. cond., moving, must sell. $13,000 firm.  415-555-6541", 408, 416),
  29. #(135, "4-Door Sedan", "Honda Civic", 1993, 12500, "1993 Honda Civic LX, 4 dr. sedan, blk. ext./ gray velour int. Sunroof, pwr windows, ac, 25k miles, must sell,  $12,500. 707-555-9953",130, 395),
  30. #(136, "2-Door Sedan", "Honda Civic", 1993, 12000, "1993 Honda Civic EX Coupe, this one has it all, cranberry ext./ gray int., ac, ps, windows, CD/ cass. $12,000 obo, 408-555-6936", 370, 160),
  31. #(137, "2-Door Sedan", "Honda Civic", 1987, 11500, "1987 Honda Civic LX, 2 dr. sedan, white ext./gray velour int. 5 spd., ac, ps, pdl, cc, tilt, theft-proof Pioneer cass. 82k mi., immed. sale, $8,500, 415-555-6489", 438, 438),
  32. #(138, "Sports Car", "Honda Civic", 1993, 14000, "1993 Honda Civic Del Sol 5 spd. 15k miles! all records. trans. warrenty. perf. cond. CD player, hurry won't last at $14,000, 408-555-7848", 370, 199),
  33. #(139, "Sports Car", "Honda Civic", 1993, 15000, "1993 Honda Civic Del Sol manual trans., loaded, CD/ cass. must sell, I'm pregnant with twins! make offer $15,000  415-555-6321",135, 361),
  34. #(140, "4-Door Sedan", "Achieva", 1993, 9000, "1993 Olds. Achieva, low miles, exlnt. cond., 1 owner. blue ext./tan cloth int.  includes pull-out Kenwood stereo. $9,000 obo. 415-555-8956", 197, 140),
  35. --#(141, "4-Door Sedan", "VW Jetta", 1991, 8000, "1991 VW Jetta GL, 5 spd., am-fm stereo, new tires, 38k mi., sunroof, ps, only $8,000, obo. 415-5553485", 130, 361),
  36. --#(142, "4-Door Sedan", "VW Jetta", 1992, 9500, "1992 VW Jetta, exlnt cond., 1 owner, has all records, ac, pwr windows, CD/ cass., make offer $10,000, 408-555-2456", 401, 432),
  37. --#(143, "4-Door Sedan", "VW Jetta", 1992, 11000, "1992 VW Jetta, 35k easy miles, turquoise ext./ drk. blue int. ac, ps, 5spd.,  Wolfsberg edition, alloys, $11,000 obo., 415-555-2465", 170, 130),
  38. #(144, "Station Wagon", "Honda Civic", 1992, 10000, "1992 Honda Civic EX wagon, rose gray ext. w/drk. gray int. fully loaded, sunroof, make offer, $10,000, 510-555-4152", 360, 271),
  39. #(145, "Station Wagon", "Honda Civic", 1992, 11000, "1992 Honda Civic LX wagon, airbags, pwr, tilt, 25k mi., super clean, all records, CD/ cass., moving must sell $11,000, 415-555-8785", 424, 429),
  40. #(146, "2-Door Sedan", "Acura Legend", 1991, 23000, "1991 Acura Legend Coupe, rose gray ext. w/ lt. tan leather int. super clean, low mi., 5 spd., divorce forces sale, $23,000, 408-555-6699", 370, 252),
  41. #(147, "2-Door Sedan", "Acura Legend", 1992, 25000, "1992 Acura Legend Coupe, 5 spd., all pwr., black w/ tan leather, moonroof, 23k miles, CD player, $25,000 obo, 510-555-1411", 430, 402),
  42. #(148, "Convertible", "Mazda Miata", 1991, 11500, "1991 Mazda Miata, cass., alloys, exlnt. cond., all records, low miles, death forces sale, $11,500. 408-555-4665", 170, 141),
  43. #(149, "Convertible", "Mazda Miata", 1992, 17000, "1992 Mazda Miata, special edition year, blk. w/ tan leather, BBS wheels, wood int. decor, super clean, $17,000 obo, 415-555-5231", 390, 279),
  44. #(150, "Convertible", "Mazda Miata", 1993, 14000, "1993 Mazda Miata, B package, pwr windows, ac, CD/cass., only 15k mi., hurry, won't last, $14,000, 415-555-6987",159, 370),
  45. #(151, "2-Door Sedan", "Toyota Corolla", 1992, 10000, "1992 Toyota Corolla, 4 cyl., 5 spd., great economy car, red ext. w/ gray int., am-fm cass., only 26k miles, asking $10,000, 510-555-7845",150, 391),
  46. #(152, "2-Door Sedan", "Toyota Corolla", 1992, 10900, "1992 Toyota Corolla, at, ac, rear spoiler, 29k miles, 1 owner, very clean car, cranberry/drk. gray, $10,900 obo, 415-555-9889", 391, 190),
  47. #(153, "Sports Car", "Mazda RX7", 1992, 28000, "1992 Mazda RX7. almost new!, 20k miles, silver ext. w/ black leather int., ABS, CD/cass., airbags,  pregnant, must sell $28,000, 408-555-6523", 420, 250),
  48. #(154, "Sports Car", "Ford Probe", 1992, 10000, "1992 Ford Probe GT, 5 spd., fully loaded, trans. warrenty, 25k miles!,  very clean in and out, $10,000, will trade, 415-555-3748",371, 180),
  49. #(155, "Sports Car", "Ford Probe", 1990, 6500, "1990 Ford Probe, 5 spd., grey/grey ext./ int., am-fm cass., great cond., 50k miles., never had problems, $6,500 obo, 415-555-6542", 407, 403),
  50. #(156, "Sports Car", "Ford Probe", 1990, 7200, "1990 Ford Probe GL, at, ac, ps, pb, pm, alarm, alum whls., new brakes, well maint., must sell by 1/30, no reasonable offer refused, $7,200 obo., 408-555-2547", 420, 401),
  51. #(157, "Sport-Utility", "Isuzu Trooper", 1992, 12000, "1992 Isuzu Trooper, exlnt. cond., alarm, bike/surf racks inclu., moving to Europe, must sell, $12,000. 415-555-3458", 398, 240),
  52. #(158, "Sport-Utility", "Isuzu Trooper", 1992, 13000, "1992 Isuzu Trooper, only 38k miles, 5 spd., fully equipped, CD/cass. blk ext. w/ gray int. $13,000 obo, 510-555-5684", 381, 160),
  53. #(159, "4-Door Sedan", "Volvo", 1991, 12000, "1991 Volvo, intercooler, red w/ tan leather int. only 30k miles, like new, ABS, pwr seats, windows, must sell, $12,000 415-555-6352",129, 365),
  54. #(160, "4-Door Sedan", "Volvo", 1992, 13000, "1992 Volvo, intercooler, air bags, ABS, fully loaded, CD/ cass., pwr everything, $13,000 obo 408-555-9658", 387, 171)
  55. )
  56.  
  57. local scriptDir := theScriptDir
  58. local titleDir := parentDir theScriptDir
  59. local theMediaDir := spawn scriptDir "carAds"
  60.  
  61. -- Make the StorageContainer for the car database.
  62. local theLib := new LibraryContainer \
  63.     dir:titleDir \
  64.     path: "cars.sxl" \
  65.     mode:@create \
  66.     targetCollection:(new HashTable)
  67.  
  68. for ad in classifiedData do
  69. (
  70.     local theFile := (ad[1] as String)
  71.     local theFilename := theFile + ".bmp"
  72.  
  73.     local theStream := getStream theMediaDir theFileName @readable
  74.     local bm := importMedia theImportExportEngine theStream \
  75.         @image @dib @bitmap
  76.     append ad bm
  77. )
  78.  
  79. -- add to the container
  80. add theLib @data classifiedData
  81.  
  82. close theLib
  83. )
  84.  
  85. "Compiled build ad database.sx"
  86. -->>>
  87.